Add a --min-time option to make small benchmarks run more iterations#1324
Add a --min-time option to make small benchmarks run more iterations#1324lialan wants to merge 6 commits into
--min-time option to make small benchmarks run more iterations#1324Conversation
|
Thanks I think this is a great idea! I haven't looked at the code in detail yet, so just some thoughts here on the interface.
The default behaviour when no flags are used should be the same as you proposed here, but with this any existing usage of |
What about just by default set |
|
Having the default automatically run for some set amount of time seems useful. I took a look at some other benchmarking tools, and it seems in line with what they do as well. |
Those changes are made:
Turn on |
Add --min-time flag (default 3.0s) to ensure benchmarks run long enough for stable timing. Times the warmup call, computes needed iterations via ceil(min_time / warmup_time), and uses max(computed, --iter) as the actual count. --iter becomes a floor rather than an exact count. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Previously --iter acted as a floor, so --min-time could only increase iterations beyond --iter. Now when --min-time is active, its computed iteration count is used directly. --iter is only a fallback when --min-time is disabled (set to 0). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
46d81fe to
618e3d4
Compare
Previously we've seen measured time swings of the benchmark results:
This patch adds a
--min-timeoption, which will:min-time.--itervalue is smaller than the calculated value, replace it with the calculated value.To give an example, with
--min-time 5, a non-trivial gemm:will gets auto-adjust:
which should amortize away a lot of the swings. Since 0.0007s is still a bit noisy.